package com.leyou.sms.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Configuration 指定当前类是一个配置类，让spring来加载读取其中的配置内容
 */
@Configuration
public class SmsConfiguration {

    @Bean
    public IAcsClient client(SmsProperties prop){
        DefaultProfile profile = DefaultProfile.getProfile(prop.getRegionID(), prop.getAccessKeyID(), prop.getAccessKeySecret());
        IAcsClient client = new DefaultAcsClient(profile);
        return client;
    }
}
